
#ifndef SUPERBLOCK_H_
#define SUPERBLOCK_H_


//#include <stdio.h>
//#include <iostream>
//#include <sys/types.h>
//#include <sys/stat.h>
//#include <fcntl.h>
#include <unistd.h>
//#include <iostream>
//#include <fstream>


class SuperBlock {
private:
	/*super block information stored on disk*/
	int fileSysSize;
	int sizeOfBlock;
	int numOfRootINode;
	int numOfFreeBlocksInFileSys;
	int pointerIntoBlockOfFreeBlocks;
	int pointerToTheLastBlockOfFreeBlocks;
	int sizeOfINodeArray;
	int numOfFreeINodesInFileSys;
	int pointerIntoBlockOfFreeINodes;
	int pointerToTheLastBlockOfFreeINodes;

	/*more information about file sys*/
	int totalNumOfBlocks;

	int numOfOccupiedBlocksByInodes;

	int fileDescriptor;

public:
	/*called when there is no given configuration file*/
	SuperBlock(int fd);

	/*called when there is a configuration file - fresh copy os FILE_SYS*/
	SuperBlock(int fileSystemSize, int blockSize, int numOfINodes, int fileSysDescriptor);

	virtual ~SuperBlock();

	/*Getters*/

	int getFileSysSize();

	int getSizeOfBlock();

	int getNumOfRootINode();

	int getNumOfFreeBlocksInFileSys();

	int getPointerIntoBlockOfFreeBlocks();

	int getPointerToTheLastBlockOfFreeBlocks();

	int getSizeOfINodeArray();

	int getNumOfFreeINodesInFileSys();

	int getPointerIntoBlockOfFreeINodes();

	int getPointerToTheLastBlockOfFreeINodes();


	int getTotalNumOfBlocks();

	int getNumOfOccupiedBlocksByInodes();

	/*Setters*/

	void setNumOfFreeBlocksInFileSys(int newNumOfFreeBlocks);

	void incNumOfFreeBlocksInFileSys();

	void decNumOfFreeBlocksInFileSys();

	void incNumOfFreeInodesInFileSys();

	void decNumOfFreeInodesInFileSys();

	void setPointerIntoBlockOfFreeBlocks(int newPointerIntoBlockOfFreeBlocks);

	void setPointerToTheLastBlockOfFreeBlocks(int newPointerToTheLastBlockOfFreeBlocks);

	void setNumOfFreeINodesInFileSys(int newNumOfFreeINodes);

	void setPointerIntoBlockOfFreeINodes(int newPointerIntoBlockOfFreeINodes);

	void setPointerToTheLastBlockOfFreeINodes(int newPointerToTheLastBlockOfFreeINodes);


	void writeToPhysicalDisk();


};

#endif /* SUPERBLOCK_H_ */
